﻿CREATE PROCEDURE ReportCostofServices
	(
		@startDate date,
		@endDate date
	)
AS
BEGIN
	SELECT distinct 
		   u.FullName, 
		   p.Name as Project, 
		   e.EntryDate, 
		   e.BillableHours
	
	FROM dbo.EntryLog as e inner join
		 dbo.Users as u on (e.UserID = u.UserID) inner join
		 dbo.Projects as p on (e.ProjectID = p.ProjectID) and (p.ProjectTypeID <> 3)
	WHERE (e.EntryDate >= @startDate) AND (e.EntryDate <= @endDate) and ((u.UserTypeID = 1) or (u.UserTypeID = 4))
	ORDER BY u.FullName, p.Name, e.EntryDate
END